<template>
	<view class="container">
		<TopBtn v-if="type==1" :title="'普通诊窒设置'"></TopBtn>
		<TopBtn v-if="type==2" :title="'专家诊室设置'"></TopBtn>
		<TopBtn v-if="type==3" :title="'诊室设置'"></TopBtn>
		<view class="nav" v-if="type==3">
			<view :class="{ 'act': act==2 }" @click="act=2">
				专家门诊
			</view>
			<view :class="{ 'act': act==1 }" @click="act=1">
				普通门诊
			</view>
		</view>
		<view class="info" v-if="act==2">
			<view class="currency_card">
				<view class="currency_title">
					接诊类型
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.expertText==1" src="@/static/CommonTools/act.png" @click="data.expertText=0" mode="">
						</image>
						<text class="" v-else @click="data.expertText=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/tw.png" mode=""></image> 图文接诊
						</view>
					</view>
					<view class="zjInput flex-center">
						价格：
						<!-- <uni-easyinput v-model="data.textAmount" type="number" placeholder=""></uni-easyinput> -->
						<uni-number-box v-model="data.textAmount" :min="0" :max="9999"  />
						<text>
							元/2天
						</text>
					</view>
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.expertSpeech==1" src="@/static/CommonTools/act.png" @click="data.expertSpeech=0" mode="">
						</image>
						<text class="" v-else @click="data.expertSpeech=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/yy.png" mode=""></image> 语音接诊
						</view>
					</view>
					<view class="zjInput flex-center">
						价格：
						<!-- <uni-easyinput v-model="data.speechAmount" type="number" placeholder=""></uni-easyinput> -->
						<uni-number-box v-model="data.speechAmount" :min="0" :max="9999" />
						<text>
							元/2天
						</text>
					</view>
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.expertVideo==1" src="@/static/CommonTools/act.png" @click="data.expertVideo=0" mode="">
						</image>
						<text class="" v-else @click="data.expertVideo=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/sp.png" mode=""></image> 视频接诊
						</view>
					</view>
					<view class="zjInput flex-center">
						价格：
						<!-- <uni-easyinput v-model="data.videoAmount" type="number" placeholder=""></uni-easyinput> -->
						<uni-number-box v-model="data.videoAmount" :min="0" :max="9999" />
						<text>
							元/2天
						</text>
					</view>
				</view>
			</view>
		</view>
		<view class="info" v-if="act==1">
			<view class="currency_card">
				<view class="currency_title">
					接诊类型
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.ordinaryText==1" src="@/static/CommonTools/act.png" @click="data.ordinaryText=0" mode="">
						</image>
						<text class="" v-else @click="data.ordinaryText=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/tw.png" mode=""></image> 图文接诊
						</view>
					</view>
					<view class="zjInput flex-center" v-if='data.outpatientSettingDO'>
						价格：
						<uni-number-box v-model="data.textMoney" :min="0"
							:max="parseInt(data.outpatientSettingDO.pictureTextOutpatient) " />
						<text>
							元/2天 <text>(不高于{{data.outpatientSettingDO.pictureTextOutpatient}})</text>
						</text>
					</view>
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.ordinarySpeech==1" src="@/static/CommonTools/act.png" @click="data.ordinarySpeech=0"
							mode=""></image>
						<text class="" v-else @click="data.ordinarySpeech=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/yy.png" mode=""></image> 语音接诊
						</view>
					</view>
					<view class="zjInput flex-center" v-if='data.outpatientSettingDO'>
						价格：
						<uni-number-box v-model="data.speechMoney" :min="0"
							:max="parseInt(data.outpatientSettingDO.speechOutpatient) " />
						<text>
							元/2天 <text>(不高于{{data.outpatientSettingDO.speechOutpatient}})</text>
						</text>
					</view>
				</view>
				<view class="currency_info">
					<view class="zjAct flex-center">
						<image v-if="data.ordinaryVideo==1" src="@/static/CommonTools/act.png" @click="data.ordinaryVideo=0"
							mode=""></image>
						<text class="" v-else @click="data.ordinaryVideo=1"></text>
						<view class="actTitle flex-center-center">
							<image src="@/static/CommonTools/sp.png" mode=""></image> 视频接诊
						</view>
					</view>
					<view class="zjInput flex-center" v-if='data.outpatientSettingDO'>
						价格：
						<uni-number-box v-model="data.videoMoney" :min="0"
							:max="parseInt(data.outpatientSettingDO.videoOutpatient)" />
						<text>
							元/2天 <text>(不高于{{data.outpatientSettingDO.videoOutpatient}})</text>
						</text>
					</view>
				</view>
			</view>

		</view>
		<view class="info">
			<view class="warning currency_card">
				<view class="title flex-center">
					<image src="@/static/CommonTools/warning.png" mode=""></image> 服务内容
				</view>
				<view class="text">
					1、问诊期间不限交流次数，有效期最长48小时 <br />
					2、语音问诊和视频问诊建议与客户约定好问诊时间 <br />
					3、问诊价格修改提交后48小时内不允许再次修改，请谨慎提
					交接诊价格。
				</view>
			</view>
		</view>
		<view class="CommonToolsbtn flex-center-center" @click="createDoctorSettings()">
			保存
		</view>

	</view>
</template>

<script>
	import {
		getDoctorSettings,
		createDoctorSettings
	} from '@/api/commonTools'
	export default {
		data() {
			return {
				act: 2,
				value: "",
				addlist: [],
				data: {},
				type: 1,
			};
		},
		onLoad() {
			this.getDoctorSettings()
		},
		methods: {
			getDoctorSettings() {
				getDoctorSettings().then(res => {
					this.data = res.data
					if (this.data.consultationSource == 1) {
						this.act = this.data.consultationSource
						this.type = 1
					} else if (this.data.consultationSource == 2) {
						this.act = this.data.consultationSource
						this.type = 2
					} else {
						this.type = 3
					}
				})
			},
			createDoctorSettings() {
				createDoctorSettings(this.data).then(res => {
					uni.showToast({
						title: '操作成功',
						duration: 2000,
						icon: 'none',
						mask: true
					})
					this.getDoctorSettings()
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.warning {
		image {
			width: 30rpx;
			height: 30rpx;
			margin-right: 15rpx;
		}

		font-weight: 500;
		font-size: 28rpx;
		color: #333333;

		.text {
			color: #999;
		}
	}

	/deep/.uni-easyinput {
		width: 267rpx !important;
	}

	/deep/.uni-easyinput__content {
		width: 267rpx;
		height: 80rpx;
		background-color: #FAFAFA !important;
		border-radius: 20rpx;
		border: none;
	}

	.info {
		padding: 30rpx;

		.currency_info {
			margin-top: 25rpx;

			.actTitle {
				width: 195rpx;
				height: 68rpx;
				background: #FFFFFF;
				border-radius: 34rpx;
				border: 1px solid #EEEEEE;
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;

				image {
					width: 29rpx;
					height: 25rpx;
					margin-right: 12rpx;
				}
			}

			.zjInput {
				font-weight: 500;
				font-size: 28rpx;
				color: #999999;
				margin-top: 25rpx;

				text {
					margin: 0 20rpx;
					color: #333333;
					flex: 1;

					text {
						color: #999;
						font-size: 22rpx
					}
				}

			}

			.zjAct {
				text {
					width: 27rpx;
					height: 27rpx;
					display: inline-block;
					background: #FFFFFF;
					border: 1px solid #999999;
					box-sizing: border-box;
					margin-right: 25rpx;
				}

				&>image {
					width: 27rpx;
					height: 27rpx;
					margin-right: 25rpx;
				}
			}
		}
	}

	.nav {
		background-color: #fff;
		font-size: 32rpx;
		color: rgba(51, 51, 51, 0.5);
		line-height: 28rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 60rpx;

		view {
			flex: 1;
			text-align: center;
		}

		.act {
			color: #333333;
			font-weight: bold;
		}
	}
</style>